import React, { useRef, useState } from 'react'

export default function App() {
    const [count, setCount] = useState(0)
    const countRef = useRef(0)
    return (
        <div>
            <button onClick={() => {
                setCount(count + 1)
                countRef.current ++
            }}>增加</button>
            {count} - {countRef.current}
        </div>
    )
}
